#ifndef EITEM_META_PROPERTY_H
#define EITEM_META_PROPERTY_H

#include <DefineLibCommon.h>
#include <DefineCommon.h>
#include <cstdint>
#include <functional>
#include <delegate/delegate.h>

/**definations of item's property, the core is a Qt's QVariant object to wrap all c++ variable types.
 *class Item will referense this.
 * */
struct EItemMetaProperty;
typedef SmartPtr(EItemMetaProperty) EItemMetaPropertyPtr;
struct COMMON_DLL EItemMetaProperty
{
    EString name;
    EString nameCN;
    EString typeName = "empty";
    EVariant value;
    bool ifReadOnly = false;
    bool ifShowUI = true;
    EString groupName;
    EVariant defaultValue;
    EVariant minValue;
    EVariant maxValue;
    EString unitName;
    EStringList enumNames;
    EString additionalInfo;


    typedef void (*Fun_setProperty)(intptr_t m_owner, const EVariant&);
    typedef void (*Fun_getProperty)(intptr_t m_owner, EVariant&);

    void setPropertyValue(const EVariant& value);
    void getPropertyValue(EVariant& value);

    Fun_setProperty m_funSetProperty = NULL;
    Fun_getProperty m_funGetProperty = NULL;

    intptr_t m_owner;

    long getTag();

    // std::function<void(const EVariant& value)> funSetProperty;
    // std::function<void(EVariant& value)> funGetProperty;
    // void setOwner(intptr_t owner);
    // intptr_t getOwner();
};


#endif // EITEM_META_PROPERTY_H 
